import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/Index.vue'
// 学生列表
import Student from '@/components/student.vue'
// 组件应用
import Zujian from '@/components/zujian.vue'
// 组件之间通信
import iphone from '@/components/iphone.vue'
// DOM操作
import domVue from '@/components/dom.vue'
// MintUI操作
import mintVue from '@/components/mint.vue'
// router-link 传值
import routerVue from '@/components/router.vue'
// 列表
import listVue from '@/components/list.vue'
// 详情
import xiangVue from '@/components/xiangqing.vue'
// 编程导航
import navVue from '@/components/propgramnav.vue'
// 404显示
import notVue from '@/components/notFound.vue'
// 挂载属性
Vue.use(Router)
// 创建路由对象并配置路由规则
export default new Router({
  routes: [
    {
      path: '/',   //条件
      name: '首页',
      component: Index, //模板组件名字
      children:[
        {
          path:'/', 
          name:'Student',
          component:Student
        },{
          path:'zujian',
          name:"组件应用",
          component:Zujian
        },{
          path:'iphone',
          name:"组件通信",
          component:iphone
        },{
          path:'dom',
          name:"Dom操作",
          component:domVue
        },{
          path:'mint',
          name:'mintUI例子',
          component:mintVue
        },{
          path:'router',
          name:'router',
          component:routerVue,
          children:[
            {
              path:'/',
              name:'列表页',
              component:listVue
            },{
              //  如果通过path传值,则需要在path路径后面声明一下,查询字符串时不需要
              path:'xiang/:id',
              name:'xiang',
              component:xiangVue
            }
          ]
        },{
          path:'nav',
          name:"编程导航",
          component:navVue
        }
      ]
    },{
      path:'*',
      name:'这是404显示的',
      component:notVue
    }


  ]
})
